/*********************************************************************************
 *      Copyright:  (C) 2022 Zhang Changxing<ZhangChangxingVIP@163.com>
 *                  All rights reserved.
 *
 *       Filename:  transf_format.h
 *    Description:  This file is interchangeable between string format and CJSON format.
 *                 
 *        Version:  1.0.0(05/1/2022)
 *         Author:  Zhang Changxing <ZhangChangxingVIP@163.com>
 *      ChangeLog:  1, Release initial version on "05/1/2022  01:33:25 AM"
 *                 
 ********************************************************************************/

#ifndef  _CJSON_H_
#define  _CJSON_H_

/*System library*/
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <pthread.h>

/*Third-party libraries*/
#include "sqlite3.h"
#include "cJSON.h"
#include "iniparser.h"

/*Custom header files*/
#include "ds18b20.h"
#include "database.h"
#include "transf_format.h"
#include "sms.h"



/*--------------------------------------------------------------------------------------------------
 *   description:   Convert string format to CJSON forma
 *          args:   $mqtt:      The configuration information structure pointer that connects the broker
 *                  $pack_info: The structure of the packet to be sent
 *  return value:      <0: failure,    =0:ok 
 *--------------------------------------------------------------------------------------------------*/
int pack_to_cjson(pub_ctx_t *pub_ctx, pack_info_t pack_info);

/*--------------------------------------------------------------------------------------------------
 *   description:   Parse the CJSON format to a string format
 *          args:   $mqtt:    The configuration information structure pointer that connects the broker
 *  return value:      <0: failure,    =0:ok 
 *--------------------------------------------------------------------------------------------------*/
int cjson_parse(sub_ctx_t *sub_ctx);

#endif  



